import { defineStore } from "pinia";
import { computed, ref } from "vue";
// use+模块名+Store
export const useUserStore=defineStore('user',()=>{
    // setup函数
    // state
    const num=ref(999)
    // actions
    const setNum=(val)=>{
       num.value=val
    }
    // getters
    const getNum=computed(()=>{
        return num.value*2
    })
    const xxx=ref(0)
    const setXxx=()=>{
        xxx.value++
    }
  return {xxx,setXxx,num,setNum,getNum}

},{
    // 配制项
    // persist:true
    persist:{
        paths:['xxx']
    }
})